<template>
    <div>
        <h3>pinia</h3>
        <p>id:{{id}}</p>
        <p>name:{{name}}</p>
        <p>count:{{count}}</p>
        <el-button @click="handleClick">通过pinia改变数据</el-button>
    </div>
</template>

<script setup>
import { ElButton } from 'element-plus';
import useCounter from '@/pinia/counter';
import { toRefs } from 'vue';

const counterStore = useCounter()
const { id, name, count } = toRefs(counterStore)
const handleClick = () => {
    counterStore.setCount(++count.value)
}
</script>

<style lang="less" scoped></style>
